﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace my_console
{
    public class ShapeFactory
    {
        public static Shape CreateShape(string shapeType)
        {
            Random random = new Random();

            switch (shapeType.ToLower())
            {
                case "rectangle":
                    double length = random.NextDouble() * 10 + 1;
                    double width = random.NextDouble() * 10 + 1; 
                    return new Rectangle(length, width);

                case "square":
                    double side = random.NextDouble() * 10 + 1; 
                    return new Square(side);

                case "triangle":
                    double side1 = random.NextDouble() * 10 + 1; 
                    double side2 = random.NextDouble() * 10 + 1; 
                    double side3 = random.NextDouble() * 10 + 1; 
                    return new Triangle(side1, side2, side3);

                default:
                    throw new ArgumentException("Invalid shape type.");
            }
        }
    }

}
